<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input id="text" type="text">
</body>

<script>
    text.onkeydown = function (e) {
        console.log(e.keyCode)
    }


</script>

</html>